<template>
	<div>
		<div class="bg100"></div>
		<div class="zhidinggoufang">
			<h2>注册 <span @click="closeLogin" class="close">X</span></h2>
			<form>
				<div class="zhiding-list">
					<label>账户：</label>
					<input v-model="loginObject.account" type="text" />
				</div>
				<div class="zhiding-list">
					<label>密码：</label>
					<input v-model="loginObject.password" type="password" />
				</div>
        <div class="zhiding-list">
          <label>确认密码：</label>
          <input v-model="confirmPassword" type="password" />
        </div>
        <div class="zhiding-list">
          <label>手机号：</label>
          <input v-model="loginObject.tel" type="password" />
        </div>

				<div class="zhidingsub"><input type="button" value="提交" @click="handleSubmit()"/></div>
			</form>
		</div>
	</div>
</template>

<script>
	import store from '../../common/store.js';
	export default {
		data: function() {
			return {
        confirmPassword:"",
				loginObject:{
					account:"",
					password:"",
          tel:""
				}
			};
		},
		methods: {

			handleSubmit() {
        if (this.$data.loginObject.password !== this.$data.confirmPassword ) {
          this.$Notice.error({
            title: '密码输入不一致',
          });
          return;
        }
						let self = this;
						self.http.post({
							url: "/client-login/register",
							param: self.$data.loginObject
							
						}).then(data => {
							if(data){
                console.log(data)
								self.$Notice.success({
								  title: '注册成功',
								});
								this.$router.push({
									name: "index",
									params: {
									}
								});
							} else{
								self.$Notice.success({
								  title: '注册失败',
								});
							}
						});
						
					
						
					
			},
			closeLogin: function() {
				this.$router.push({
					name: "index",
					params: {
					}
				});
			}
		},
    beforeRouteLeave(to, from, next) {
      this.$destroy();//手动销毁当前页面
      next();
    },
	}
</script>

<style>
</style>
